package gui_TJCPS;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import com.domus.dreamMenu.cliente.core.*;

public class PainelEncerrarAtendimento extends JPanel implements ActionListener{

	private JButton botaoSim;
	private JButton botaoNao;
	private JanelaPrincipal janelaPrincipal;
	private Font fonteDosBotoes;
	
	public PainelEncerrarAtendimento(JanelaPrincipal janela) {
		super();
		this.fonteDosBotoes = new Font("Candara",1,30);
		
		this.janelaPrincipal = janela;
		this.setLayout(null);
		this.botaoNao = new JButton();
		this.botaoNao.setIcon(new ImageIcon(getClass().getResource("/imagens/botaoNao.png")));
		this.botaoNao.setBounds(250,550, this.botaoNao.getIcon().getIconWidth(), this.botaoNao.getIcon().getIconHeight());
		this.botaoNao.setBorder(null);
		this.botaoNao.setText("Nao");
		this.botaoNao.setIconTextGap(-this.botaoNao.getIcon().getIconWidth() +70);
		this.botaoNao.setFont(this.fonteDosBotoes);
		this.botaoNao.setForeground(Color.white);
		this.botaoNao.addActionListener(this);
		this.add(this.botaoNao);
		
		this.botaoSim = new JButton(new ImageIcon(getClass().getResource("/imagens/botaoSim.png")));
		this.botaoSim.setBounds(500, 550, this.botaoSim.getIcon().getIconWidth(), this.botaoSim.getIcon().getIconHeight());
		this.botaoSim.setBorder(null);
		this.botaoSim.setText("Sim");
		this.botaoSim.setFont(this.fonteDosBotoes);
		this.botaoSim.setForeground(Color.white);
		this.botaoSim.setIconTextGap(-this.botaoSim.getIcon().getIconWidth() +70);
		this.botaoSim.addActionListener(this);
		this.add(this.botaoSim);		
	}
	
	
	@Override  
	public void paintComponent(Graphics g) {  
		super.paintComponent(g);  
		Image imagem = (new ImageIcon(getClass().getResource("/imagens/telaEncerrarAtendimento.png"))).getImage(); 
		if (imagem != null)  
			g.drawImage(imagem, 0, 0, this);  
	}


	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		if(e.getSource() == this.botaoSim){
			this.janelaPrincipal.exibirTelaInicialMichelli();
			Fachada.fecharConta(300);
		}else if(e.getSource() == this.botaoNao){
			this.janelaPrincipal.acaoBotaoPedirContaNaoConfirmacao();
		}
		
	}
}
